Ext.define('GBIF.ViewCard', {
		extend: 'Ext.panel.Panel'	
	,	alias: 'widget.viewCard'
	,	border: false
	,	autoScroll: true
	,	layout: 'card'
	,	id: 'viewCardID'
	,	activeItem: 0
	,	initComponent: function() {
				this.overviewPanel = Ext.create('GBIF.OverviewPanel',{
						currentActive: 'overview'
				});
				this.summaryPanel = Ext.create('GBIF.SummaryPanel',{
						currentActive: 'summary'
				});
				this.reclassifiyGrid = Ext.create('GBIF.ReclassifiyGrid',{
						currentActive: 'reclassify'
				});
				
				this.summaryPanel.on('activate', function(me){
						me.store.getProxy().extraParams = {
								cmd: 'summary'
							,	projectId: GBIF.currentProjectID
						}
						me.store.load();
				},this);
							
				this.reclassifiyGrid.on('activate', function(me){
						me.store.getProxy().extraParams = {
								cmd: 'getRecords'
							,	projectId: GBIF.currentProjectID
						}
						me.store.load();
				},this);
				
				this.items = [this.overviewPanel, this.reclassifiyGrid, this.summaryPanel];
				this.callParent();
		}
	,	genrateDWCA: function(){
			Ext.Ajax.request({
						url: Config.baseUrl + 'resources/api/api.php'
					,	params: {
								cmd: 'archive'
							,	projectId: GBIF.currentProjectID
						}
					,	method: 'POST'
					,	scope: this
					,	success: function (response) {
							var o = Ext.decode(response.responseText);
							if(o.success){
								GBIF.currentStatus = o.status;
								this.overviewPanel.updateTpl(GBIF.currentStatus);
							} else {
								GBIF.Notice.msg(this.msgErrorTitle, o.error.errorMessage);
							}
						}
					,	failure: function () {
							GBIF.Notice.msg(this.msgErrorTitle, this.msgFatalError);
						}
				});
		}
	,	changeLayout: function(id){
				var l = this.getLayout();
				l.setActiveItem(id);
				this.doLayout();
				this.fireEvent('layoutChanged', id, this);
		}		
});